package cn.iocoder.yudao.module.artifact.dal.mysql.info;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.artifact.dal.dataobject.info.InfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.artifact.controller.admin.info.vo.*;

/**
 * 文玩信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InfoMapper extends BaseMapperX<InfoDO> {

    default PageResult<InfoDO> selectPage(InfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InfoDO>()
                .likeIfPresent(InfoDO::getName, reqVO.getName())
                .eqIfPresent(InfoDO::getCategory, reqVO.getCategory())
                .eqIfPresent(InfoDO::getMaterial, reqVO.getMaterial())
                .eqIfPresent(InfoDO::getWeight, reqVO.getWeight())
                .eqIfPresent(InfoDO::getLength, reqVO.getLength())
                .eqIfPresent(InfoDO::getWidth, reqVO.getWidth())
                .eqIfPresent(InfoDO::getHeight, reqVO.getHeight())
                .eqIfPresent(InfoDO::getYear, reqVO.getYear())
                .betweenIfPresent(InfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoDO::getId));
    }

}